Repository navigation
Tab rows no longer scroll when every tab fits - #331
Merged
Merged
Conversation
The shared tab row (components/tabs.tsx) pulled its list down 1px with a negative bottom margin so the active underline would sit on the nav's border. The list is inside an overflow-x-auto box, which makes the box scroll on both axes, so the list ended up 1px taller than the box and the box scrolled even when every tab fit, drawing a scrollbar under the tabs on desktop. The base line is now the list's own bottom border, and each tab pulls down 1px onto it inside the list's box, so nothing overflows. The list is at least as wide as its tabs, so the line runs the full scrolled width on a phone. e2e/tabs-no-scroll.spec.ts checks every page with a tab row.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a wide desktop screen the run page's tab row (Overview, Changes, Activity, Details) showed a scrollbar even though all four tabs fit. The cause was in the shared tab row (
components/tabs.tsx), so the same problem was on every page that uses it: the run page, Analytics, Tests, Platform admin, Agent permissions, Deliveries, the agent page under Skills, the section tabs (Code review, Logs, Insights and so on) and the Instructions tabs.Root cause: the tab list had
-mb-pxso the active underline would overlap the nav's bottom border. The list sits insideScrollFade'soverflow-x-autobox. When one axis is set to scroll, the other one scrolls too, so the negative margin made the list 1px taller than the box (scrollHeight 45 vs clientHeight 44, measured). The box could scroll whether or not the tabs fit, and browsers that always show scrollbars drew one under the tabs. The scroll box also clipped that 1px, so the overlap the margin was meant to create never showed.Changes
dashboard/src/components/tabs.tsx: the base line is now the list's own bottom border. Each tab pulls down 1px onto that border, inside the list's box, so nothing spills out of the scroll box and the active underline sits on the line as intended. The list ismin-w-max, so on a phone, when the tabs do scroll, the line runs the full scrolled width. The nav no longer draws its own border. When a phone shows the tabs as a select, the border moves under the select. The scroll box getstestId="tab-row"so tests can find it.dashboard/e2e/tabs-no-scroll.spec.ts(new): for 10 pages with a tab row, at 1280px and 1600px wide, every tab row's scroll box must have scrollWidth <= clientWidth and scrollHeight <= clientHeight. At 375px the page must not scroll sideways, and no tab row may scroll up and down. A listed page that stops drawing a tab row fails the test, so the list can't go stale without anyone noticing.Verification
E2E_STATIC=1: tabs-no-scroll, no-sideways-scroll, layout, analytics, tests, logs, skills, settings, shell-nav, audit-runs, audit-shell, admin, deliveries, agent-permissions, readable-text, run-trigger and audit-reviewer. 455 passed. One test in tests.spec.ts failed only because of a trace file I removed by hand while it ran; I reran tests.spec.ts on its own and all 25 passed.npm run lint,npm run typecheckandnpm run check:openapiin dashboard/: all clean. Root eslint is clean on the changed files.